	import {
		mapGetters,
	} from 'vuex'
export default {
	// 混入的选项节点
	// 计算属性 - 侦听器
	computed: {
		...mapGetters("cart", ["total"])
	},
	onShow() {
		if (this.total > 0) {
			uni.setTabBarBadge({
				index: 2,
				text: "" + this.total
			})
		} else {
			uni.removeTabBarBadge({
				index: 2
			})
		}
	}, 
	watch: {
		total: {
			immediate: true,
			handler(newValue) {
				console.log('mixins混入------', newValue);
				if (newValue > 0) {
					uni.setTabBarBadge({
						index: 2,
						text: "" + newValue
					})
				} else {
					uni.removeTabBarBadge({
						index: 2
					})
				}
			}
		}
	},
}